﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;

namespace IR.Common.Utilities
{
    public static class Validation
    {
        /// Written by Alex http://stackoverflow.com/questions/5342375/c-sharp-regex-email-validation
        /// <summary>
        /// Sees if this is a valid email
        /// </summary>
        /// <param name="emailaddress">Email as string</param>
        /// <returns>True if valid</returns>
        public static bool IsValidEmail(string emailaddress)
        {
            try
            {
                MailAddress m = new MailAddress(emailaddress);
                return true;
            }
            catch (FormatException)
            {
                return false;
            }
        }
    }
}
